﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule.NodeEditorContentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converters="clr-namespace:Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule" AutomationProperties.AutomationId="NodeEditorControl" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <UserControl.Resources>
        <Converters:ExecutorStatusVisibilityConverter x:Key="ExecutorStatusConverter"/>
        <Converters:SchedulerStatusVisibilityConverter x:Key="SchedulerStatusConverter"/>
        <BooleanToVisibilityConverter x:Key="VisibilityConverter"/>
    </UserControl.Resources>
    <Grid>
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" d:LayoutOverrides="GridBox">
            <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" Background="#FFFFFFFF" BorderBrush="#FFE0E0E0">
                <Grid Margin="0,0,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"/>
                        <RowDefinition Height="36"/>
                        <RowDefinition Height="Auto" MinHeight="67.104"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="60"/>
                    </Grid.RowDefinitions>
                    <Border CornerRadius="5,5,0,0" Grid.Row="1">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFFBFBFB" Offset="0"/>
                                <GradientStop Color="#FFF0F0F0" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding Path=NodeDeleteCommand}" Visibility="{Binding Path=SelectedNode.CompleteNodeViewModel, Converter={StaticResource VisibilityConverter}}" Style="{DynamicResource deleteButton}" Width="26" Height="26" Content="Button" ToolTip="Delete" Margin="5,0,0,0"/>
                        </StackPanel>
                    </Border>


                    <Grid HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.ColumnSpan="1"  Grid.Row="2" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="72"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Width="72" HorizontalAlignment="Left" Source="pack://Application:,,,/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ManagementStudio/nodesHeader.png" VerticalAlignment="Top"/>
                        <TextBlock VerticalAlignment="Top" TextAlignment="Justify" Text="Nodes in the system facilitate the execution of workflows in Trident.  When the executor and scheduler services are started in the node, it gets registered in the application registry. Once registered in the registry, you can select the node for the execution of a workflow." TextWrapping="Wrap" Margin="10,0,0,0" Grid.Column="1"/>
                    </Grid>
                    <ScrollViewer Grid.Row="3" Margin="10,0,10,10"  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
                        <Grid VerticalAlignment="Stretch" Margin="5,10,5,5">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Margin="50,0,0,0" Grid.Row="0" Grid.RowSpan="1" Visibility="{Binding Path=SelectedNode.CompleteNodeViewModel, Converter={StaticResource VisibilityConverter}}">
                                <Border CornerRadius="5,5,5,5" BorderThickness="0,0,0,0" BorderBrush="#FFC4C4C4" Background="#FFFFFFFF" Margin="0,10,10,0">
                                	<Grid>
                                		<Grid.ColumnDefinitions>
                                			<ColumnDefinition Width="115"/>
                                			<ColumnDefinition Width="*"/>
                                		</Grid.ColumnDefinitions>
                                		<Grid.RowDefinitions>
                                			<RowDefinition Height="Auto" MinHeight="27" />
                                			<RowDefinition Height="Auto" MinHeight="27" />
                                			<RowDefinition Height="Auto" MinHeight="50" />
                                			<RowDefinition Height="Auto" MinHeight="27" />
                                			<RowDefinition Height="Auto" MinHeight="27" />
                                			<RowDefinition Height="Auto" MinHeight="27" />
                                			<RowDefinition Height="Auto" MinHeight="37" />
                                			<RowDefinition Height="Auto" MinHeight="37" />
                                			<RowDefinition Height="Auto" MinHeight="32" />
                                			<RowDefinition Height="Auto" MinHeight="32" />
                                			<RowDefinition Height="Auto" MinHeight="43" />
                                		</Grid.RowDefinitions>
                                		<TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Text="ID:" TextWrapping="Wrap" Margin="0,5,5,0"/>
                                		<TextBlock HorizontalAlignment="Right" Text="Name:" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Row="1" Margin="0,5,5,0"/>
                                		<TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Grid.Column="1" IsEnabled="False" Text="{Binding Path=SelectedNode.Name}" MaxLines="1" MaxLength="100" Margin="0,5,0,0" Grid.Row="1"/>
                                		<TextBox AutomationProperties.AutomationId="NodeDescription" Text="{Binding Path=NodeDescription, UpdateSourceTrigger=PropertyChanged}" MaxLength="200" MaxLines="2" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="2" Height="45" VerticalScrollBarVisibility="Auto">
                                			<TextBox.BorderBrush>
                                				<LinearGradientBrush EndPoint="0,20" StartPoint="0,0" MappingMode="Absolute">
                                					<GradientStop Color="#FFABADB3" Offset="0.05"/>
                                					<GradientStop Color="#FFE2E3EA" Offset="0.07"/>
                                					<GradientStop Color="#FFBDBDBD" Offset="1"/>
                                				</LinearGradientBrush>
                                			</TextBox.BorderBrush>
                                		</TextBox>
                                		<TextBlock HorizontalAlignment="Right" Text="Description:" TextWrapping="Wrap" Margin="0,5,5,0" VerticalAlignment="Top" Grid.Row="2"/>
                                		<TextBlock Text="Availability:" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Row="3" Margin="0,5,5,0" HorizontalAlignment="Right"/>
                                		<TextBlock Text="Modified By:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                		<TextBlock Text="Modified Date:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="5" VerticalAlignment="Top" HorizontalAlignment="Right"/>
                                		<TextBlock Visibility="{Binding Path=SelectedNode.HpcCluster}" HorizontalAlignment="Right" Text="Number of Concurrent Jobs" TextWrapping="Wrap" Margin="0,5,5,0" VerticalAlignment="Top" Grid.Row="6"/>
                                		<TextBlock Visibility="{Binding Path=SelectedNode.HpcCluster}" HorizontalAlignment="Right" Text="Compute Node Installed Directory" TextWrapping="Wrap" Margin="0,5,5,0" VerticalAlignment="Top" Grid.Row="7"/>
                                		<TextBlock Visibility="{Binding Path=SelectedNode.HpcCluster}" Text="Cluster User Name" TextWrapping="Wrap" Margin="10,10,6,31" Grid.Row="8" Grid.RowSpan="2" />
                                		<TextBlock Visibility="{Binding Path=SelectedNode.HpcCluster}" Text="Cluster Passowrd" TextWrapping="Wrap" Margin="20.02,12,5,0" VerticalAlignment="Top" Grid.Row="9" Height="15.96" />
                                		<TextBox Text="{Binding Path=SelectedNode.Id}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="0" Width="250" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" IsEnabled="False"/>
										<TextBox IsEnabled="False" Text="{Binding Path=SelectedNode.LastModifiedBy}" Grid.Column="1" Grid.Row="4" TextWrapping="Wrap" Margin="0,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250"/>
                                		<ComboBox AutomationProperties.AutomationId="AvailabilityCombobox" SelectedValuePath="Content"  SelectedValue="{Binding Path=MachineAvailability}" IsSynchronizedWithCurrentItem="True" Margin="0,5,0,0" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250">
                                			<ComboBoxItem Content="Online" IsSelected="True"/>
                                			<ComboBoxItem Content="Offline"/>
                                		</ComboBox>
                                		<Grid Margin="0,5,0,0" Grid.Column="1" Grid.Row="5">
                                			<TextBox Text="{Binding Path=SelectedNode.LastModifiedTime}" IsEnabled="False" TextWrapping="Wrap" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250"/>
                                		</Grid>
                                		<Grid Visibility="{Binding Path=SelectedNode.HpcCluster}" Margin="0,5,0,0" Grid.Column="1" Grid.Row="6">
                                			<TextBox IsEnabled="True" AutomationProperties.AutomationId="MaxConcurrentJobs" Text="{Binding Path=MaxConcurrentJobs, UpdateSourceTrigger=PropertyChanged}" MaxLength="20" MaxLines="1" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="6"/>
                                		</Grid>
                                		<Grid Visibility="{Binding Path=SelectedNode.HpcCluster}" Margin="0,5,0,0" Grid.Column="1" Grid.Row="7">
                                			<TextBox IsEnabled="True" AutomationProperties.AutomationId="HPCInstalledPath" Text="{Binding Path=ComputeInstalledDirectory, UpdateSourceTrigger=PropertyChanged}" MaxLength="260" MaxLines="1" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="7"/>
                                		</Grid>
                                		<Grid Visibility="{Binding Path=SelectedNode.HpcCluster}" Margin="0,5,0,0" Grid.Column="1" Grid.Row="8">
                                			<TextBox IsEnabled="True" AutomationProperties.AutomationId="ClusterUser" Text="{Binding Path=ClusterUser, UpdateSourceTrigger=PropertyChanged}" MaxLength="200" MaxLines="1" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="8"/>
                                		</Grid>
                                		<Grid Visibility="{Binding Path=SelectedNode.HpcCluster}" Margin="0,5,0,0" Grid.Column="1" Grid.Row="9">
                                            <PasswordBox Name="ClusterPassword" IsEnabled="True" AutomationProperties.AutomationId="ClusterPass" MaxLength="200" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="9" PasswordChanged="ClusterPassword_PasswordChanged" />
                                        </Grid>
                                		<Grid Visibility="{Binding Path=SelectedNode.ExecutorVisibility}" HorizontalAlignment="Left" Width="140" Grid.Column="1" Grid.Row="3" Grid.RowSpan="3" VerticalAlignment="Top" Margin="255,3,0,0">
                                			<Path HorizontalAlignment="Stretch" Stretch="Fill" Stroke="#FFB9B9B9" Data="M34.97099,0.5 L130.02899,0.5 C135.25968,0.50000027 139.49999,4.7403114 139.49999,9.9709991 L139.49999,41.949002 C139.49999,47.179688 135.25968,51.419998 130.02899,51.419998 L34.97099,51.419998 C29.740302,51.419998 25.49999,47.179688 25.499991,41.949002 L25.499991,19.00084 0.5,13.970257 25.925539,7.3112352 C27.03583,3.36913 30.668349,0.50000027 34.97099,0.5 z">
                                				<Path.Fill>
                                					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                						<GradientStop Color="#FFECECEC" Offset="0"/>
                                						<GradientStop Color="#FFFFFFFF" Offset="1"/>
                                					</LinearGradientBrush>
                                				</Path.Fill>
                                			</Path>
                                			<Grid Background="{x:Null}" Margin="28,0,0,0">
                                				<Grid Margin="6,6,6,4">
                                					<StackPanel Margin="3,0,0,0">
                                						<Grid Margin="0,0,0,0" ToolTip="{Binding Path=SelectedNode.MachineErrorMessage}">
                                							<Grid.ColumnDefinitions>
                                								<ColumnDefinition Width="20"/>
                                								<ColumnDefinition Width="*"/>
                                							</Grid.ColumnDefinitions>
                                							<Grid Height="10" Width="10" Visibility="{Binding Path=SelectedNode.MachineStatus, Converter={StaticResource ExecutorStatusConverter}, ConverterParameter=Running}">
                                								<Path HorizontalAlignment="Center" VerticalAlignment="Center" Width="10" Height="10" Stretch="Fill" Stroke="{x:Null}" Data="M6.8951887,16.304384 L11.678273,19.044145 C14.821318,15.054074 18.791804,11.458935 23.588642,8.2582103 L25.223231,9.1068546 C19.556545,13.756536 15.746314,19.238102 13.165745,25.270685 L4.7132385,18.647389 z">
                                									<Path.Fill>
                                										<LinearGradientBrush EndPoint="0.842,0.865" StartPoint="0.158,0.135">
                                											<GradientStop Color="#FF10C403" Offset="0"/>
                                											<GradientStop Color="#FF076800" Offset="1"/>
                                										</LinearGradientBrush>
                                									</Path.Fill>
                                								</Path>
                                							</Grid>
                                							<Grid Width="10" Height="10" Visibility="{Binding Path=SelectedNode.MachineStatus, Converter={StaticResource ExecutorStatusConverter}, ConverterParameter=NotRunning}">
                                								<Path Stretch="Fill" Stroke="{x:Null}" Data="M22.654792,8.0512508 L25.68132,9.6898405 C20.014634,14.339522 15.746314,19.238102 13.165745,25.270685 L11.540279,23.488415 C11.540279,23.488415 12.87335,17.346967 22.654792,8.0512508 z" RenderTransformOrigin="0.5,0.5">
                                									<Path.Fill>
                                										<LinearGradientBrush EndPoint="0.842,0.865" StartPoint="0.158,0.135">
                                											<GradientStop Color="#FFFF2828" Offset="0"/>
                                											<GradientStop Color="#FF680000" Offset="1"/>
                                										</LinearGradientBrush>
                                									</Path.Fill>
                                									<Path.RenderTransform>
                                										<TransformGroup>
                                											<ScaleTransform ScaleX="1" ScaleY="1"/>
                                											<SkewTransform AngleX="0" AngleY="0"/>
                                											<RotateTransform Angle="9.458"/>
                                											<TranslateTransform X="-0.0081510500692023591" Y="0.016532415186254035"/>
                                										</TransformGroup>
                                									</Path.RenderTransform>
                                								</Path>
                                								<Path Stretch="Fill" Stroke="{x:Null}" Data="M22.65419,7.933294 L25.68132,9.6898405 C20.014634,14.339522 15.746314,19.238102 13.165745,25.270685 L11.539677,23.370459 C11.539677,23.370459 12.872748,17.229011 22.65419,7.933294 z" RenderTransformOrigin="0.5,0.5">
                                									<Path.Fill>
                                										<LinearGradientBrush EndPoint="0.842,0.865" StartPoint="0.158,0.135">
                                											<GradientStop Color="#FFFF2828" Offset="0"/>
                                											<GradientStop Color="#FF680000" Offset="1"/>
                                										</LinearGradientBrush>
                                									</Path.Fill>
                                									<Path.RenderTransform>
                                										<TransformGroup>
                                											<ScaleTransform ScaleX="1" ScaleY="1"/>
                                											<SkewTransform AngleX="0" AngleY="0"/>
                                											<RotateTransform Angle="-69.533"/>
                                											<TranslateTransform X="0.0035678593824717275" Y="-0.14686011309525782"/>
                                										</TransformGroup>
                                									</Path.RenderTransform>
                                								</Path>
                                							</Grid>
                                							<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1" Text="Executor" TextWrapping="Wrap"/>
                                						</Grid>
                                						<Grid Margin="0,5,0,5" ToolTip="{Binding Path=SelectedNode.SchedulerErrorMessage}">
                                							<Grid.ColumnDefinitions>
                                								<ColumnDefinition Width="20"/>
                                								<ColumnDefinition Width="*"/>
                                							</Grid.ColumnDefinitions>
                                							<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1" Text="Scheduler" TextWrapping="Wrap"/>
                                							<Grid Width="10" Height="10" Visibility="{Binding Path=SelectedNode.SchedulerStatus, Converter={StaticResource SchedulerStatusConverter}, ConverterParameter=NotRunning}">
                                								<Path Stretch="Fill" Stroke="{x:Null}" Data="M22.654792,8.0512508 L25.68132,9.6898405 C20.014634,14.339522 15.746314,19.238102 13.165745,25.270685 L11.540279,23.488415 C11.540279,23.488415 12.87335,17.346967 22.654792,8.0512508 z" RenderTransformOrigin="0.5,0.5">
                                									<Path.Fill>
                                										<LinearGradientBrush EndPoint="0.842,0.865" StartPoint="0.158,0.135">
                                											<GradientStop Color="#FFFF2828" Offset="0"/>
                                											<GradientStop Color="#FF680000" Offset="1"/>
                                										</LinearGradientBrush>
                                									</Path.Fill>
                                									<Path.RenderTransform>
                                										<TransformGroup>
                                											<ScaleTransform ScaleX="1" ScaleY="1"/>
                                											<SkewTransform AngleX="0" AngleY="0"/>
                                											<RotateTransform Angle="9.458"/>
                                											<TranslateTransform X="-0.0081510500692023591" Y="0.016532415186254035"/>
                                										</TransformGroup>
                                									</Path.RenderTransform>
                                								</Path>
                                								<Path Stretch="Fill" Stroke="{x:Null}" Data="M22.65419,7.933294 L25.68132,9.6898405 C20.014634,14.339522 15.746314,19.238102 13.165745,25.270685 L11.539677,23.370459 C11.539677,23.370459 12.872748,17.229011 22.65419,7.933294 z" RenderTransformOrigin="0.5,0.5">
                                									<Path.Fill>
                                										<LinearGradientBrush EndPoint="0.842,0.865" StartPoint="0.158,0.135">
                                											<GradientStop Color="#FFFF2828" Offset="0"/>
                                											<GradientStop Color="#FF680000" Offset="1"/>
                                										</LinearGradientBrush>
                                									</Path.Fill>
                                									<Path.RenderTransform>
                                										<TransformGroup>
                                											<ScaleTransform ScaleX="1" ScaleY="1"/>
                                											<SkewTransform AngleX="0" AngleY="0"/>
                                											<RotateTransform Angle="-69.533"/>
                                											<TranslateTransform X="0.0035678593824717275" Y="-0.14686011309525782"/>
                                										</TransformGroup>
                                									</Path.RenderTransform>
                                								</Path>
                                							</Grid>
                                							<Grid Height="10" Visibility="{Binding Path=SelectedNode.SchedulerStatus, Converter={StaticResource SchedulerStatusConverter}, ConverterParameter=Running}" Margin="5,0,5,2.98" VerticalAlignment="Bottom">
                                								<Path HorizontalAlignment="Center" VerticalAlignment="Center" Width="10" Height="10" Stretch="Fill" Stroke="{x:Null}" Data="M6.8951887,16.304384 L11.678273,19.044145 C14.821318,15.054074 18.791804,11.458935 23.588642,8.2582103 L25.223231,9.1068546 C19.556545,13.756536 15.746314,19.238102 13.165745,25.270685 L4.7132385,18.647389 z">
                                									<Path.Fill>
                                										<LinearGradientBrush EndPoint="0.842,0.865" StartPoint="0.158,0.135">
                                											<GradientStop Color="#FF10C403" Offset="0"/>
                                											<GradientStop Color="#FF076800" Offset="1"/>
                                										</LinearGradientBrush>
                                									</Path.Fill>
                                								</Path>
                                							</Grid>
                                						</Grid>
                                					</StackPanel>
                                				</Grid>
                                			</Grid>
                                		</Grid>
                                	</Grid>
                                </Border>
                            </StackPanel>
                        </Grid>
                    </ScrollViewer>
                    
                    <Border Margin="0,0,0,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#FFFFFFFF">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                <GradientStop Color="#FFE8E8E8" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <TextBlock Text="Node" TextWrapping="Wrap" FontSize="14" FontWeight="Normal" Margin="7,2,0,0"/>
						</Border>

                    <Border Margin="0,10,0,0" Grid.Column="1" Grid.ColumnSpan="1" Grid.Row="4" Grid.RowSpan="1" BorderBrush="#FFC1C1C1" BorderThickness="0,1,0,0" Padding="0,10,0,0">
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding Path=SelectedNode.CompleteNodeViewModel, Converter={StaticResource VisibilityConverter}}">
                            <DockPanel HorizontalAlignment="Right" VerticalAlignment="Top" LastChildFill="False">
                                <Button AutomationProperties.AutomationId="NodeSaveButton" Command="{Binding Path=NodeSaveCommand}" Width="70" Content="Save"/>
                                <Button IsEnabled="true" AutomationProperties.AutomationId="NodeCancelButton" Command="{Binding Path=NodeCancelCommand}" Width="70" Content="Cancel" Margin="5,0,0,0"  />
                            </DockPanel>
                        </Grid>
                    </Border>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</UserControl>
